<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${MODEL.packageName}">
	<!--sql段所有字段名 -->
	<sql id="columns">
	<#list MODEL.property as item> 
			<#if item_has_next>
			${item.COLUMN_NAME},
			<#else>
			${item.COLUMN_NAME}
			</#if>
		</#list>	
	</sql>
	<!--sql段所有属性名 -->
	<sql id="values">
	<#list MODEL.property as item>
		<#if item_has_next>
			${'#'}{${item.PROPERTY}},
			<#else>
			${'#'}{${item.PROPERTY}}
		</#if>
	</#list>	
	 
	</sql>
	<!--sql段set -->
	<sql id="set">
	<!--不遍历id -->
	<#list MODEL.property as item>
		<#if item_index!=0>
		<#if item_has_next>
		<if test="(${item.PROPERTY}!=null)">
			${item.COLUMN_NAME} = ${'#'}{${item.PROPERTY}}, 
		</if>
		<#else>
		<if test="(${item.PROPERTY}!=null)">
			${item.COLUMN_NAME} = ${'#'}{${item.PROPERTY}}
		</if>
		</#if>
		</#if>
	</#list>	
		
	</sql>

	<sql id="where">
		<#list MODEL.property as item>
		<if test="(${item.PROPERTY}!=null)">
			and	${item.COLUMN_NAME} = ${'#'}{${item.PROPERTY}},
		</if>
	</#list>	
	</sql>

</mapper>